package com.wongsi.spring5.controller;

import com.wongsi.spring5.entity.Taco;
import com.wongsi.spring5.repository.TacoRepository;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

import javax.annotation.Resource;

@RestController
@RequestMapping("/design")
public class DesignTacoController {

    @Resource
    private TacoRepository tacoRepo;

    @GetMapping("/recent")
    public Flux<Taco> recentTacos() {
        return tacoRepo.findAll().take(12);
    }
}
